package name.fowler.refactoring.simplestore;

public class Rental {
	private Movie m_Movie;
	private int m_DaysRented;

	public Rental(Movie movie, int daysRented) {
		m_Movie = movie;
		m_DaysRented = daysRented;
	}

	public int getDaysRented() {
		return m_DaysRented;
	}

	public Movie getMovie() {
		return m_Movie;
	}

	public double getAmount() {
		return m_Movie.getStrategy().getAmount(getDaysRented());
	}

	public int countFrequency() {

		// Add frequent renter points
		int freq = 1;

		// Add bonus for a two-day new-release rental
		if ((getDaysRented() > 1) && m_Movie.getStrategy().getFrequency()) {
			freq++;
		}
		return freq;
	}
}
